<?php

namespace app\common\model;

use think\Model;

class File extends Model
{
    public function add($data){
        if (!is_array($data)){
            exception('传递数据不合法');
        }

        $this->allowField(true)->save($data);

        return true;
    }


    public function addArr($data){
        $this->allowField(true)->saveAll($data);
        return true;
    }

    public static function add_data($data){
        return self::insertGetId($data);
    }

    public static function insert_into_one($data){
        $arr = array();
        $arr['file_name'] = $data['file_name'];
        $arr['save_name'] = $data['save_name'];
        $arr['file_ext'] = $data['file_ext'];
        $arr['file_size'] = $data['file_size'];
        $arr['bucket'] = $data['bucket'];
        $arr['file_status'] = $data['file_status'];
        $arr['on_time'] = $data['on_time'];
        $res = self::insertGetId($arr);
        return $res;
    }
}
